import React, { Component } from "react";
import "./App.css";

import { withRouter, Route } from "react-router-dom";

class Home extends Component {
  componentDidMount() {
    console.log(this.props.match.params);
  }
  render() {
    return <h2>home组件</h2>;
  }
}

class App extends Component {
  render() {
    return (
      <div>
        <button onClick={() => this.goDetail()}>goDetail</button>
        <Route path="/home/:id/:name" exact component={Home}></Route>
      </div>
    );
  }
  goDetail() {
    this.props.history.push("/home/1/fly");
  }
}

export default withRouter(App);
